<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <input type="text" v-model="msg" @keyup.enter="add" />
      <h1>未完成事件</h1>
      <div v-for="(item1,index) in todoList" :key="item1.id">
        <input
          type="checkbox"
          @change="doneList.push(...todoList.splice(index,1))"
        />
        <span>{{ item1.name }}</span>
        <button @click="todoList.splice(index,1)">删除</button>
      </div>
      <h1>已经完成事件</h1>
      <div v-for="(item2,index) in doneList" :key="item2.id">
        <input
          type="checkbox"
          checked
          @change="todoList.push(...doneList.splice(index,1))"
        />
        <span>{{ item2.name }}</span>
        <button @click="doneList.splice(index,1)">删除</button>
      </div>
    </div>
  </body>
</html>
